<?php
	include_once("DataProvider.php");
	include_once("../DTO/tinhTrangDTO.php");
	
	class tinhTrangDAO
	{
		public $sql = "";
		var $tinhTrangDTO;
		function __construct()
		{
			return $this->tinhTrangDTO = new tinhTrangDTO();
		}	
		
		public function load()
		{
			$result = DataProvider::ExecuteQuery($this->sql);
			$arrTinhTrangDTO = new ArrayObject();
			
			while($row=mysql_fetch_array($result))
			{
				$tinhTrangDTO = new tinhTrangDTO;
				$tinhTrangDTO->idTinhTrang = $row['idTinhTrang'];
				$tinhTrangDTO->tenTinhTrang = $row['tenTinhTrang'];
				
				$arrTinhTrangDTO[] = $tinhTrangDTO;
			}
			return $arrTinhTrangDTO;
		}
		
		public function load_All()
		{
			$this->sql = 'select * from tinhTrang';
			$result = $this->load();
			return $result;
		}
		
		public function load_One($idTinhTrang)
		{
			$this->sql ='select * from tinhTrang where idTinhTrang='.$idTinhTrang;
			$result = $this->load();
			return $result;
		}
		
		
		
	}
	
?>